API Documentation
Public Member Functions | List of all members
nkGraphics::RenderContext Class Referenceabstract

A rendering context, attached to a graphic window to present to the screen. More...

Public Member Functions

 RenderContext ()
 
virtual ~RenderContext ()
 
TexturegetBackBuffer () const
 
TexturegetDepthBuffer () const
 
ViewportgetViewport () const
 
CompositorgetCompositor () const
 
int getContextWidth () const
 
int getContextHeight () const
 
bool isWindowFocused () const
 
nkWinUi::GraphicsWindowgetAttachedWin () const
 
bool getOwnsWindow () const
 
void setCompositor (Compositor *value)
 
void setOwnsWindow (bool value)
 
virtual void setGammaCorrected (bool value)=0
 
virtual void initialize (nkWinUi::GraphicsWindow *window)=0
 
virtual void swap ()=0
 
virtual void refreshBufferSize (unsigned int width=0, unsigned int height=0)=0
 
virtual void refreshViewportSize ()
 

Detailed Description

A rendering context, attached to a graphic window to present to the screen.

Constructor & Destructor Documentation

◆ RenderContext()

nkGraphics::RenderContext::RenderContext ( )

Constructor. See RenderContextManager::createRenderContext() and derived.

◆ ~RenderContext()

virtual nkGraphics::RenderContext::~RenderContext ( )
virtual

Destructor.

Member Function Documentation

◆ getBackBuffer()

Texture* nkGraphics::RenderContext::getBackBuffer ( ) const
Returns
The texture serving as a back buffer.

◆ getDepthBuffer()

Texture* nkGraphics::RenderContext::getDepthBuffer ( ) const
Returns
The depth buffer associated to the context.

◆ getViewport()

Viewport* nkGraphics::RenderContext::getViewport ( ) const
Returns
The viewport used.

◆ getCompositor()

Compositor* nkGraphics::RenderContext::getCompositor ( ) const
Returns
The compositor the context is using. If nullptr, it means the default compositor within the CompositorManager is used.

◆ getContextWidth()

int nkGraphics::RenderContext::getContextWidth ( ) const
Returns
The width, in pixels, of the context.

◆ getContextHeight()

int nkGraphics::RenderContext::getContextHeight ( ) const
Returns
The height, in pixels, of the context.

◆ isWindowFocused()

bool nkGraphics::RenderContext::isWindowFocused ( ) const
Returns
Whether the context window is focused (true) or not (false).

◆ getAttachedWin()

nkWinUi::GraphicsWindow* nkGraphics::RenderContext::getAttachedWin ( ) const
Returns
The attached window in which the context renders.

◆ getOwnsWindow()

bool nkGraphics::RenderContext::getOwnsWindow ( ) const
Returns
Whether the context owns the window (true) or not (false). A context owns a window when it is not fed a window from external code.

◆ setCompositor()

void nkGraphics::RenderContext::setCompositor ( Compositor value)

Sets the compositor the context should be rendered with.

Parameters
valueThe compositor to use. Can be reset with nullptr.

◆ setOwnsWindow()

void nkGraphics::RenderContext::setOwnsWindow ( bool  value)

Sets whether the context owns the window it is attached to.

Parameters
valueWhether the context owns the window (true) or not (false).

◆ setGammaCorrected()

virtual void nkGraphics::RenderContext::setGammaCorrected ( bool  value)
pure virtual

Sets whether the context should be gamma corrected or not.

Parameters
valueWhether the context should be gamma corrected (true) or not (false).

◆ initialize()

virtual void nkGraphics::RenderContext::initialize ( nkWinUi::GraphicsWindow window)
pure virtual

Initializes and loads all internal memory necessary.

◆ swap()

virtual void nkGraphics::RenderContext::swap ( )
pure virtual

Part of the rendering logic. In theory, should not be called by external code.

◆ refreshBufferSize()

virtual void nkGraphics::RenderContext::refreshBufferSize ( unsigned int  width = 0,
unsigned int  height = 0 
)
pure virtual

Callback for when the window size changes. Can also be used to resize manually the surfaces (window, texture) the context owns.

Parameters
widthThe wanted width of the surface, in pixels.
heightThe wanted height of the surface, in pixels.
Remarks
If coordinates are left at 0, then the context will resize its internal buffers to fit the new sizes of either the window or the texture used. If coordinates have values > 0, then they are used to also resize the surfaces, provided the context owns them (created along with the context).

◆ refreshViewportSize()

virtual void nkGraphics::RenderContext::refreshViewportSize ( )
virtual

Callback for when the window size changes.


The documentation for this class was generated from the following file: